/**
 * 
 */
package de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.tests;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.DigitFeatures;
/**
 * 
 * @author Christoph Teichmann
 * created Jun 7, 2014 8:52:50 PM
 * @version 0.1
 */
public class TestDigitFeatures
{
	/**
	 * 
	 */
	private DigitFeatures df;
	/**
	 *
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception
	{df = new DigitFeatures();}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.DigitFeatures#process(java.lang.String)}.
	 */
	@Test
	public final void testProcess()
	{
		assertEquals(df.process("5563th"),"1th");
		assertEquals(df.process("5563th3422"),"1th1");
		assertEquals(df.process("th"),"th");
	}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.DigitFeatures#name()}.
	 */
	@Test
	public final void testName()
	{assertEquals(df.name(),"NUMFEATURES");}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.GenericFeatureGenerator#getFeatName(java.lang.String)}.
	 */
	@Test
	public final void testGetFeatName()
	{
		assertEquals(df.getFeatName("32425"),"ONLYNUM");
		assertEquals(df.getFeatName("32425sdf"),"STARTNUM");
		assertEquals(df.getFeatName("32425sdf23542"),"MIXED");
		assertEquals(df.getFeatName("32425sdf23542asdasd"),"MIXED");
		assertEquals(df.getFeatName("sdf23542asdasd"),"MIXED");
		assertEquals(df.getFeatName("sdf23542"),"ENDNUM");
		assertEquals(df.getFeatName("sdf"),"NONUM");
		
	}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.GenericFeatureGenerator#updateWeight(java.lang.String, boolean, double)}.
	 */
	@Test
	public final void testUpdateWeight()
	{
		assertEquals(df.updateWeight("hans", true, 20.0),1.0,0.000001);
		assertEquals(df.updateWeight("hans", false, 20.0),21.0,0.000001);
		assertEquals(df.updateWeight("hans", false, 0.0),1.0,0.000001);
	}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.GenericFeatureGenerator#getFeatureOptions()}.
	 */
	@Test
	public final void testGetFeatureOptions()
	{assertEquals(df.getFeatureOptions().toString(),"[STARTNUM, ONLYNUM, NONUM, MIXED, ENDNUM]");}
	/**
	 * Test method for {@link de.uni_leipzig.informatik.asv.unsupervised_pos_tagger.datacreation.feature_types.GenericFeatureGenerator#getType()}.
	 */
	@Test
	public final void testGetType()
	{assertEquals(df.getType(),"multinomial");}
}
